<template>
	<view class="setting">
		<view class="option">
			<view class="title">个人信息</view>
			<view class="list">
				<view class="item" @click="editUserInfo">
					<view class="text">个人资料</view>
					<view class="icon"><uni-icons type="forward" size="40rpx"></uni-icons></view>
				</view>
				<view class="item" @click="changePwd">
					<view class="text">修改密码</view>
					<view class="icon"><uni-icons type="forward" size="40rpx"></uni-icons></view>
				</view>
			</view>
		</view>

		<view class="option">
			<view class="title">操作</view>
			<view class="list"><view class="item" @click="logout">退出</view></view>
		</view>

		<view class="option">
			<view class="title">版本</view>
			<view class="list">
				<view class="item">{{ version }}</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			version: ''
		};
	},
	onLoad() {
		this.version = this.$version;
	},
	methods: {
		logout() {
			uni.removeStorageSync('access_token');
			uni.removeStorageSync('userinfo');
			uni.removeStorageSync('wxUserInfo');
			this.$store.commit('logout');
			this.folderList = [];
			this.avatar = '';
			uni.showToast({
				title: '已退出登录'
			});
			setTimeout(() => {
				uni.switchTab({
					url: '../../mine/mine'
				});
			}, 1000);
		},

		// 打开编辑用户信息
		editUserInfo() {
			uni.navigateTo({
				url: '../userInfo/userInfo'
			});
		},

		// 打开忘记密码
		changePwd() {
			uni.navigateTo({
				url: '../changepwd/changepwd'
			});
		}
	}
};
</script>

<style lang="scss">
.setting {
	padding: 20rpx 32rpx 0;
	.option {
		margin-bottom: 80rpx;
	}
	.title {
		font-size: 32rpx;
		text-shadow: 0px 0px #000;
		// font-weight: 700;
	}
	.item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 40rpx;
		// font-weight: 700;
		font-size: 40rpx;
		text-shadow: 0px 0px #000;
	}
	.icon {
		font-weight: 700;
	}
}
</style>
